import * as imysql from '../lib/mysql/mysql';

console.log("mysql-test");

export function main(){
    let sql = "SELECT * FROM yxtest.newtable1 WHERE `a_id`=:a_id ";
    imysql.query(sql,{"a_id":2},(err,result)=>{
        console.log("sql1:",result);
    });

    let sql2 = "SELECT * FROM newtable1 WHERE `a_id`=:a_id ";
    imysql.query(sql2,{"a_id":1},(err,result)=>{
        console.log("sql2:",result);
    },"yxtest");

    let sql3 = "SELECT * FROM newtable1 WHERE `a_id`=:a_id ";
    imysql.query(sql3,{"a_id":3},(err,result)=>{
        console.log("sql3:",result);
    },"yxtest2");

    //处于开发模式中，自动开启sql语句输出
    // setTimeout(function() {
    //     console.log(imysql.lastSql);
    // }, 1000);
    console.log("ok");

    // setInterval(function(){
    //     console.log('loading');
    //     let sql3 = "SELECT sleep(2),a_id FROM newtable1 WHERE `a_id`=:a_id ";
    //     imysql.query(sql3,{"a_id":3},(err,result)=>{
    //         console.log("sql3:",result);
    //     },"yxtest2");
    // },500);
}
